<?php
namespace YzPay\Hooks;
class YzPayOrderHooks extends \HooksController {
//生成订单
	function order_after_make_yzpay(&$param) {
		$order_sn = $param['order_sn'];
		$model = BoxModel("yz_order");
		$row = $model->create($param);
		$r = $model->add($row);
		return $r;
	}
	//支付成功
	function order_paySuc_yzpay(&$param) {
		$order_sn = $param['order_sn'];
		$model = BoxModel("yz_order");
		$r = $model->where(array('order_sn' => $order_sn))->save(array('status' => 2));
		if ($r) {
			$r2 = Logic("YzPay", "User")->inc_money($order_sn);
			//资金增加成功,给代理增加资金
			if ($r2) {
				$r2 = Logic("YzPay", "User")->inc_agent_money($order_sn);
			}
		}

	}

	//加载
	function order_load_yzpay(&$param) {
		$order_sn = $param['order_sn'];
		$data = BoxModel("yz_order")->where(array('order_sn' => $order_sn))->find();
		$param = array_merge($param, (array) $data);
	}

	//取消
	function order_cancel_subject(&$param) {

	}

}
